package com.wyj.utils

import androidx.core.content.ContextCompat
import com.wyj.utils.annotation.NotProguard
import java.io.File

@NotProguard
object AppConfig {
    @NotProguard
    object DEFAULT {
        val VERSION: String by lazy {
            val context=MApplication.application
            val packageManager = context.packageManager
            val packageInfo = packageManager.getPackageInfo(context.packageName, 0)
            packageInfo.versionName
        }

        @JvmField
        val APP_ROOT_DIR: String = ContextCompat.getExternalCacheDirs(MApplication.application).first().absolutePath

        @JvmField
        val APP_TEMP_DIR: String = "${APP_ROOT_DIR}/temp"

        @JvmStatic
        val PICTURE_SELECTOR_DIR = "${APP_ROOT_DIR}/pictureSelector/"

        init {
            FileUtils.deleteFiles(APP_TEMP_DIR)
            File("${APP_TEMP_DIR}/").mkdirs()
            File(PICTURE_SELECTOR_DIR).mkdirs()
        }
    }

    @NotProguard
    object EVENT_CODE {
        class EXIT_APPLICATION
    }
}
